package Server.UI.Test;

import java.util.ArrayList;
import java.util.Date;

import org.hibernate.sql.Select;

import EntityCondivise.ETimeRecord;
import Server.Controller.CSession;
import Server.Controller.CGestireTimeRecordControl;
import Server.Entity.IceClasses.EConsulenteI;
import Server.Entity.IceClasses.ETaskI;
import Server.Entity.IceClasses.ETimeRecordI;
import Server.TechnicalServices.Foundation.FdbFacade;

public class UCGestisciTimeRecordEstensioni {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		FdbFacade fdb = new FdbFacade();
		CSession sessione = CSession.instanza();
		sessione.setLoggato((EConsulenteI) fdb.load(EConsulenteI.class, 4));
		CGestireTimeRecordControl control = new CGestireTimeRecordControl();
		
		stampaTimerecord(control.getTimeRecordList());
		
		control.selectTimeRecord((ETimeRecordI) fdb.load(ETimeRecordI.class,8));
		
		control.modificaTimeRecord(new Date(), new Date(), "commento");
		
		stampaTimerecord(control.getTimeRecordList());
		
		control.selectTask((ETaskI) fdb.load(ETaskI.class,14));
		
		/*control.eliminaTimerecord((ETimeRecordI) fdb.load(ETimeRecordI.class, 9));
		
		stampaTimerecord(control.getTimeRecordList());*/
		
		control.createTimeRecord(new Date(), new Date(), "commento");
		
		stampaTimerecord(control.getTimeRecordList());
		

		
	}
	
	public static void stampaTimerecord(ArrayList<ETimeRecord> trlist)
	{
		System.out.print("lista timerecord lunga "+trlist.size()+"\n");
		for(ETimeRecord tr:trlist)
		{
			System.out.print(((ETimeRecordI) tr).getId()+" "+((ETimeRecordI) tr).getTesto()+"\n");
		}
	}

}
